package springboot.p2.resource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @description: 使用ConfigurationProperties
 * @author: lzp
 * @createTime: 2021-08-28 00:55
 **/
@Component
@ConfigurationProperties(prefix = "book")
@PropertySource("classpath:springboot/p2/resource/book.yaml")
public class ConfigService {
    @Value("${bookAuthor}")
    private String bookAuthor;
    @Value("${bookName}")
    private String bookName;

    public String getBookAuthor() {
        return bookAuthor;
    }

    public void setBookAuthor(String bookAuthor) {
        this.bookAuthor = bookAuthor;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }
}


